import Vue from 'vue'
import App from './App.vue'
import router from './router' // vue-router配置
import store from './store' // vuex配置
import i18n from './locale' // 国际化配置
import filters from './filters' // vue过滤器
import api from "./api/common"


import "./common/directive.js"
// 没有添加被动事件监听器来阻止'touchstart'事件，请考虑添加事件管理者'passive'，以使页面更加流畅。
import 'default-passive-events'
// 自定义的toast（这里仅做示例，需自己根据需求变动）
import Toast from './components/toast/index'
Vue.use(Toast);
// if (process.env.NODE_ENV === 'production') {
const { mockXHR } = require('./mock/index')
mockXHR()
//   }  

Vue.config.productionTip = false
Vue.prototype.$api = api
Vue.prototype.$observable = Vue.observable

console.log(Vue.prototype);



import ElementUI from 'element-ui';
import 'element-ui/lib/theme-chalk/index.css';
import './style/element-variables.scss'

Vue.use(ElementUI, {
    size: store.state.size ?? 'small'
});

//解决message重复弹出
import resetMessage from './common/resetMessage';
Vue.prototype.$message = resetMessage;



import EventProxy from 'vue-event-proxy';
Vue.use(EventProxy);


import ChfDialog from './components/chf-dialog/index.js';
import chfDrawer from './components/chf-drawer/index.js';
import ChfForm from "./components/chf-form";
import ChfGrid from "./components/chf-grid";
import ChfUpload from "./components/chf-upload";
import ChfButton from "./components/chf-button";
import ChfButtonP from "./components/chf-button-permissions";

import readFile from "./components/chf-readFile/index.js";

Vue.component('ChfForm', ChfForm)
Vue.component('ChfGrid', ChfGrid)
Vue.component('ChfUpload', ChfUpload)
Vue.component('ChfButton', ChfButton)
Vue.component('ChfButtonP', ChfButtonP)
Vue.use(ChfDialog)
Vue.use(chfDrawer)
Vue.use(readFile)



import map from "./views/scottMap/components/index.js";
Vue.use(map)

//初始化主题
import { initTheme } from "./style/theme.js"
initTheme(store.state.theme)








// 如果是非线上环境，加载 VConsole（移动端适用）
// if (process.env.NODE_ENV !== 'production') {
//     var VConsole = require('vconsole/dist/vconsole.min.js');
//     var vConsole = new VConsole();
// }

// 全局过滤器
Object.keys(filters).forEach(filterName => {
    Vue.filter(filterName, filters[filterName])
})






/* eslint-disable no-new */

new Vue({
    router,
    store,
    i18n,
    render: h => h(App)
}).$mount('#app')
